// page_other/zhexiantu/zhexiantu.js
let app = getApp()
let yuming = app.globalData.yuming
import * as echarts from '../../pages/components/ec-canvass/echarts';
let chart = null
var shuzong = []
const request = require('../../config/request');
function initChart(canvas, width, height) {
  //初始化图表
  chart = echarts.init(canvas, null, {
    width: width,
    height: height,
  });
  canvas.setChart(chart);
  var option = {
    xAxis: {
      type: 'category',
      data: [1,2,3,4,5,6,7,8,9,10,11,12]
    },
    yAxis: {
      type: 'value'
    },
    series: [{
      data: [820, 932, 901, 934, 1290, 1330, 1320,900,1000,500,888,999],
      type: 'line'
    }]
  }

  /**绘制数据 */
  chart.setOption(option);
  return chart;
}
Page({
  ...request,

  /**
   * 页面的初始数据
   */
  data: {
    yuming: yuming,
    heights: "",
    title: '折线图',
    ec: {
      onInit:initChart
    },
  },
  backs() {
    wx.navigateBack({
      delta: 0
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      heights: wx.getMenuButtonBoundingClientRect().top + 5,
    })
    this.oneComponent = this.selectComponent('#mychart-dom-line');
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})